﻿Imports System.Windows.Forms

Public Class frmVentanaPrincipal

    Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs)
        Dim OpenFileDialog As New OpenFileDialog
        OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
        If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = OpenFileDialog.FileName
            ' TODO: Add code here to open the file.
        End If
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

        If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = SaveFileDialog.FileName
            ' TODO: Add code here to save the current contents of the form to a file.
        End If
    End Sub

    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
    End Sub

    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub

    Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub

    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Close all child forms of the parent.
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Close()
        Next
    End Sub

    Private Sub btnAdminUsers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdminUsers.Click

        frmAdminUser.WindowState = 0
        frmAdminUser.Show()

    End Sub

    Private Sub frmVentanaPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        lblEmpleado.Text = bd.NombreEmpleado & " " & bd.ApellidoEmpleado
        tmReloj.Start()

    End Sub

    Private Sub frmVentanaPrincipal_Closing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
        End
    End Sub

    Private Sub btnProveedor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProveedor.Click
        frmProveedor.WindowState = 0
        frmProveedor.Show()
    End Sub

    Private Sub btnCagoriaProducto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCagoriaProducto.Click
        frmCategoria.WindowState = 0
        frmCategoria.Show()
    End Sub

    Private Sub frmInventario_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInventario.Click
        frmInventario.WindowState = 0
        frmInventario.Show()
    End Sub

    Private Sub btnFacturacion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFacturacion.Click
        frmFacturacion.WindowState = 0
        frmFacturacion.Show()
    End Sub

    Private Sub FacturacionToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FacturacionToolStripMenuItem.Click
        frmFacturacion.WindowState = 0
        frmFacturacion.Show()
    End Sub

    Private Sub ProveedorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProveedorToolStripMenuItem.Click
        frmProveedor.WindowState = 0
        frmProveedor.Show()
    End Sub

    Private Sub CategoriaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CategoriaToolStripMenuItem.Click
        frmCategoria.WindowState = 0
        frmCategoria.Show()
    End Sub

    Private Sub InventarioToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InventarioToolStripMenuItem1.Click
        frmInventario.WindowState = 0
        frmInventario.Show()
    End Sub

    Private Sub AdministracionUsuariosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdministracionUsuariosToolStripMenuItem.Click
        frmAdminUser.WindowState = 0
        frmAdminUser.Show()
    End Sub

    Private Sub CalculadoraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculadoraToolStripMenuItem.Click
        Dim Proceso As New Process()
        Proceso.StartInfo.FileName = "calc.exe"
        Proceso.StartInfo.Arguments = ""
        Proceso.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmReloj.Tick
        Fecha.Text = FormatDateTime(Now, DateFormat.ShortDate)
        Hora.Text = FormatDateTime(Now, DateFormat.LongTime)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReportes.Click
        frmSeleccionarReporte.WindowState = 0
        frmSeleccionarReporte.Show()
    End Sub

    Private Sub btnRespaldos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRespaldos.Click
        frmSeleccionarRespaldo.WindowState = 0
        frmSeleccionarRespaldo.Show()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub btnCompras_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompras.Click
        frmCompra.WindowState = 0
        frmCompra.Show()
    End Sub

    Private Sub LogoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoutToolStripMenuItem.Click

        frmPVenta.Show()
        permCatProducto = False
        permCompras = False
        permFacturacion = False
        permInventario = False
        permProveedor = False
        permReportes = False
        permRespaldo = False
        permUsuario = False

        frmPVenta.txtClave.Text = ""
        frmPVenta.txtUsuario.Text = ""
        perfil = ""
        id = ""

        Me.Dispose()
    End Sub

    Private Sub RespaldosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RespaldosToolStripMenuItem.Click
        frmSeleccionarRespaldo.WindowState = 0
        frmSeleccionarRespaldo.Show()
    End Sub

    Private Sub ReportesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportesToolStripMenuItem.Click
        frmSeleccionarReporte.WindowState = 0
        frmSeleccionarReporte.Show()
    End Sub


    Private Sub AyudaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AyudaToolStripMenuItem.Click
        Dim folder As String = Environment.CurrentDirectory + "\Manual.pdf"
        Process.Start(folder)
    End Sub
End Class
